package com.zdxlz.fcmp.upms.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zdxlz.fcmp.upms.api.entity.SystemRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 角色信息表(SystemRole)表数据库访问层
 *
 * @author makejava
 * @since 2025-02-24 13:49:11
 */
@Mapper
public interface SystemRoleMapper extends BaseMapper<SystemRole> {

    @Select("""
            select sr.*
                from system_role sr left join system_user_role sur on sr.id = sur.role_id
                where sur.user_id = #{userId}
            """)
    List<SystemRole> selectRoleById(Integer userId);
}
